<template>
  <view>
    <u-tabbar :value="name" activeColor="#7E7DF3 ">
      <u-tabbar-item v-if="show || item.name=='my' || item.name=='member'" @click="select($event,index)"  :text="item.text" :name="item.name" v-for="(item,index) in tabbarList" :key="index">
        <image class="u-page__item__slot-icon" slot="active-icon" :src="`/static/image/tabbar/${item.active}`"></image>
        <image class="u-page__item__slot-icon" slot="inactive-icon" :src="`/static/image/tabbar/${item.inactive}`"></image>
      </u-tabbar-item>
    </u-tabbar>
  </view>
</template>

<script>
    export default {
        data() {
            return {
              tabbarList:[
                {
                  text:this.$t('tabbar.membershipCode'),
                  name:'member',
                  active:'member-code-select.png',
                  inactive:'member-code.png',
                  url:'pages/member/qr-code/qr-code',
                },
                {
                  text:this.$t('tabbar.mine'),
                  name:'my',
                  active:'my-select.png',
                  inactive:'my.png',
                  url:'pages/member/member-center/member-center',
                },
              ],
              parameter:{
                id:null,
              },
              show:getApp().globalData.tab.show,
              name:getApp().globalData.tab.name,
            }
        },
      methods: {
        setValue(show) {
          this.show = show;
        },
        select(e,index){
          getApp().globalData.tab.name=e;
          uni.switchTab({
            url:this.tabbarList[index].url,
          });
        },
      },
    }
</script>


<style lang="scss">
.u-page__item__slot-icon{
  width: 46rpx;
  height: 46rpx;
}
</style>
